package gdonly.top.signin.business;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import org.json.JSONException;

import java.util.HashMap;
import java.util.List;

import gdonly.top.signin.R;
import gdonly.top.signin.utils.JsonUtil;
import gdonly.top.signin.widgets.ShowStusFromCourse;

/**
 * Created by zhuzhuxia on 2017/5/14.
 */
public class QueryStuFromCourseActivity extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_querystusfromcourse);
        initViews();

    }
    private void initViews(){
        RecyclerView recyclerView= (RecyclerView) findViewById(R.id.getstufromcourse);
        recyclerView.setLayoutManager(new LinearLayoutManager(this));

        String result = getIntent().getExtras().getString("result");

        List<HashMap<String,Object>> datas = null;
        try {
            datas = JsonUtil.getStuFromCourse(result);
        } catch (JSONException e) {
            e.printStackTrace();
        }
        recyclerView.setAdapter(new ShowStusFromCourse(datas, QueryStuFromCourseActivity.this));

    }

}
